﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace RukouMVC
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute("Building", "building/{module}", new { controller = "Misc", action = "Building" });

            routes.MapRoute("Rukoud", "", new { controller = "Home", action = "Index_new" });
            routes.MapRoute("Rukou", "rukou", new { controller = "Home", action = "Index_new" });
            routes.MapRoute("others", "others", new { controller = "User", action = "Others" });
            routes.MapRoute("OthersRukouDetail", "rukou/{id}", new { controller = "Home", action = "RukouDetail"});

            routes.MapRoute("styleChange", "style/change", new { controller = "User", action = "stylechange" });

            routes.MapRoute("Register", "register", new { controller = "User", action = "register" });
            routes.MapRoute("Login", "login", new { controller = "User", action = "Login" });
            routes.MapRoute("Logout", "logout", new { controller = "User", action = "Logout" });
            routes.MapRoute("ForgetPassword", "forgetpassword", new { controller = "User", action = "forgetpassword" });
            routes.MapRoute("Setting", "setting", new { controller = "User", action = "setting" });
            routes.MapRoute("ChangePassword", "changepassword", new { controller = "User", action = "changepassword" });
            routes.MapRoute("UploadUserIcon", "uploadusericon", new { controller = "User", action = "UploadUserIcon" });

            routes.MapRoute("About", "about", new { controller = "Misc", action = "about" });
            routes.MapRoute("Contact", "contact", new { controller = "Misc", action = "contact" });
            routes.MapRoute("Help", "help", new { controller = "Misc", action = "help" });
            routes.MapRoute("Suggestions", "suggestions", new { controller = "Misc", action = "suggestions" });
            routes.MapRoute("SuggestionSubmit", "suggestionsubmit", new { controller = "Misc", action = "suggestionsubmit" });

            routes.MapRoute("MessagePals", "message/pals", new { controller = "message", action = "Pals" });
            routes.MapRoute("MessageOne2One", "message/{id}", new { controller = "message", action = "One2One" });

            routes.MapRoute("TimeSpanIndex", "time", new { controller = "timespan", action = "Index" });
            routes.MapRoute("TimeSpanCreate", "time/create", new { controller = "timespan", action = "create" });
            routes.MapRoute("TimeSpanPrivateIndex", "time/{id}", new { controller = "timespan", action = "PrivateIndex" });
            routes.MapRoute("TimeSpanStatistic", "time/statistic/{t}", new { controller = "timespan", action = "Statistic" });

            routes.MapRoute("MoneySpanIndex", "money", new { controller = "moneyspan", action = "PublicIndex" });
            routes.MapRoute("MoneySpanCreate", "money/create", new { controller = "moneyspan", action = "create" });
            routes.MapRoute("MoneySpanPrivateIndex", "money/{id}", new { controller = "moneyspan", action = "PrivateIndex" });
            routes.MapRoute("MoneySpanStatistic", "money/statistic/{t}", new { controller = "moneyspan", action = "Statistic" });

            routes.MapRoute("Topics", "topic", new { controller = "Topic", action = "Index" });
            routes.MapRoute("TopicCreate", "topic/create", new { controller = "Topic", action = "create" });
            routes.MapRoute("TopicReply", "topic/reply", new { controller = "Topic", action = "Reply" });
            routes.MapRoute("TopicDetails", "topic/{id}", new { controller = "Topic", action = "Details" });

            routes.MapRoute("AdminPhotoIndex", "admin/photo", new { controller = "Admin", action = "photoIndex" });
            routes.MapRoute("AdminPhotocreate", "admin/photo/create", new { controller = "Admin", action = "photoCreate" });
            routes.MapRoute("AdminPhotodelete", "admin/photo/delete/{id}", new { controller = "Admin", action = "photoDelete" });
            routes.MapRoute("AdminPhotodetail", "admin/photo/{id}", new { controller = "Admin", action = "photo" });

            routes.MapRoute("AdminEntryImageIndex", "admin/entryimage", new { controller = "Admin", action = "EntryImageIndex" });
            routes.MapRoute("AdminEntryImagecreate", "admin/entryimage/create", new { controller = "Admin", action = "EntryImageCreate" });
            routes.MapRoute("AdminEntryImagedelete", "admin/entryimage/delete/{id}", new { controller = "Admin", action = "EntryImageDelete" });
            routes.MapRoute("AdminEntryImagedetail", "admin/entryimage/{id}", new { controller = "Admin", action = "EntryImage" });

            routes.MapRoute("AdminUserIndex", "admin/UserIndex", new { controller = "Admin", action = "UserIndex" });



            routes.MapRoute("user", "u/{id}", new { controller = "user", action = "details" });

            routes.MapRoute("AjaxGetStylePic", "ajax/getstylepic/{entryid}/{style}", new { controller = "Ajax", action = "GetStylePic" });

            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );


            

        }

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }
    }
}